Data.gov.sg was launched in 2011 as the government’s one-stop portal to its publicly-available data sets from 70 public agencies.
a personal project
find insights from making visualizations
Singapore is a small country facing unique challenges
all data from data.gov.sg, available under the Singapore Open Data License: https://data.gov.sg/open-data-licence
The Singapore Open Data Licence aims to promote and enable easy reuse of Public Sector data to create value for the community and businesses
Singapore has one of the lowest fertility rates globally World Bank.
This despite many initiatives from the government to encourage more people to start families.
crude_birth_rate <- read_csv("data/births-and-fertility-annual/crude-birth-rate.csv")## Rows: 59 Columns: 3
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (1): level_1
## dbl (2): year, value
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
crude_birth_rate %>%
gg_line(x_var = year,
y_var = value,
title = "Crude Birth Rate (per 1,000 popultaion)",
y_title = "",
x_title = "",
caption = "Graphic: @wyuet. Source: data.gov.sg",
theme = theme_light())live_births <- read_csv("data/births-and-fertility-annual/live-births.csv")## Rows: 118 Columns: 3
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (2): level_1, value
## dbl (1): year
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
#Convert value from chr to dbl
live_births$value <- as.double(as.character(live_births$value))live_births %>%
filter(level_1 == "Total Live-births") %>%
gg_line(x_var = year,
y_var = value,
title = "Number of live births",
y_title = "",
x_title = "",
caption = "Graphic: @wyuet. Source: data.gov.sg",
theme = theme_light())total_fertility_rate_by_ethnic_group <- read_csv("data/births-and-fertility-annual/total-fertility-rate-by-ethnic-group.csv")## Rows: 177 Columns: 4
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (2): level_1, level_2
## dbl (2): year, value
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
total_fertility_rate_by_ethnic_group %>%
gg_line_col(x_var = year,
y_var = value,
col_var = level_2,
title = "Total Fertility Rate by Ethnic Groups",
y_title = "",
x_title = "",
col_title = "",
caption = "Graphic: @wyuet. Source: data.gov.sg",
theme = theme_light())age_specific_fertility_rate <- read_csv("data/births-and-fertility-annual/age-specific-fertility-rate.csv")## Rows: 413 Columns: 4
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (3): level_1, level_2, value
## dbl (1): year
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
#Convert value from chr to dbl
age_specific_fertility_rate$value <- as.double(as.character(age_specific_fertility_rate$value))Data prior to 1980 pertain to total population.
Data from 1980 onwards pertain to resident population (i.e. Singapore citizens and permanent residents).
age_specific_fertility_rate %>%
gg_line_col(x_var = year,
y_var = value,
col_var = level_2,
title = "Total Fertility Rate by Age Groups",
y_title = "",
x_title = ,
col_title = "",
caption = "Graphic: @wyuet. Source: data.gov.sg",
theme = theme_light())life_expectancy_at_birth_and_age_65_years <- read_csv("data/life-expectancy-by-sex-annual/life-expectancy-at-birth-and-age-65-years.csv")## Rows: 86 Columns: 3
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (1): level_1
## dbl (2): year, value
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
life_expectancy_at_birth_and_age_65_years %>%
gg_line_col(x_var = year,
y_var = value,
col_var = level_1,
x_title = "",
y_title = "",
col_title = "",
title = "Life Expectancy at Birth",
caption = "Graphic: @wyuet. Source: data.gov.sg",
theme = theme_light())life_expectancy_at_birth_and_age_65_years_by_sex <- read_csv("data/life-expectancy-by-sex-annual/life-expectancy-at-birth-and-age-65-years-by-sex.csv")## Rows: 172 Columns: 4
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (2): level_1, level_2
## dbl (2): year, value
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
life_expectancy_at_birth_and_age_65_years_by_sex %>%
gg_line_col(x_var = year,
y_var = value,
col_var = level_2,
x_title = "",
y_title = "",
col_title = "",
title = "Life Expectancy by Gender",
caption = "Graphic: @wyuet. Source: data.gov.sg",
theme = theme_light())total_number_of_deaths <- read_csv("data/principal-causes-of-death/total-number-of-deaths.csv")## Rows: 15 Columns: 2
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## dbl (2): year, no_of_deaths
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
total_number_of_deaths %>%
gg_line(x_var = year,
y_var = no_of_deaths,
title = "Total Number of Deaths (Annual)",
x_title = "",
y_title = "",
caption = "Graphic: @wyuet. Source: data.gov.sg",
theme = theme_light())principal_causes_of_death <- read_csv("data/principal-causes-of-death/principal-causes-of-death.csv")## Rows: 152 Columns: 6
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (3): icd, classification, disease_condition
## dbl (3): year, rank, percentage_deaths
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Being an island state, land is not a plentiful resource, and thus housing is a perennial issue.
The majority of people live in public housing, and the term evokes a different image compared to other countries.
A small proportion of people live in private landed properties.
flats_constructed_by_housing_and_development_board_annual <- read_csv("data/flats-constructed/flats-constructed-by-housing-and-development-board-annual.csv")## Rows: 41 Columns: 2
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## dbl (2): year, flats_constructed
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
flats_constructed_by_housing_and_development_board_annual %>%
gg_line(x_var = year,
y_var = flats_constructed,
title = "Flats Constructed by Housing and Development Board (Annual)",
y_title = "",
x_title = "",
caption = "Graphic: @wyuet. Source: data.gov.sg",
theme = theme_light())resale_flat_prices_based_on_registration_date_from_jan_2017_onwards <- read_csv("data/resale-flat-prices/resale-flat-prices-based-on-registration-date-from-jan-2017-onwards.csv")## Rows: 127188 Columns: 11
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (8): month, town, flat_type, block, street_name, storey_range, flat_mode...
## dbl (3): floor_area_sqm, lease_commence_date, resale_price
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
#Convert value from chr to dbl
#resale_flat_prices_based_on_registration_date_from_jan_2017_onwards$month <- as.double(as.character(resale_flat_prices_based_on_registration_date_from_jan_2017_onwards$month))#resale_flat_prices_based_on_registration_date_from_jan_2017_onwards %>%
#gg_smooth_col(x_var = month,
# y_var = resale_price,
# col_var = flat_type,
# title = "Resale Flat Prices from Jan 2017",
# y_title = "",
# caption = "Graphic: @wyuet Source: data.gov.sg",
# theme = theme_light())value_of_local_food_production_in_singapore <- read_csv("data/value-of-local-food-production/value-of-local-food-production-in-singapore.csv")## Rows: 9 Columns: 5
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## dbl (5): year, vegetables, seafood, hen_shell_eggs, local_landings
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
#convert data to long format
value_of_local_food_production_in_singapore_long <- melt(value_of_local_food_production_in_singapore, id = "year")value_of_local_food_production_in_singapore_long %>%
gg_hbar_col(x_var = value,
y_var = year,
col_var = variable,
x_title = "",
y_title = "",
col_title = "",
title = "Value of Local Food Production (million SGD)",
caption = "Graphic: @wyuet. Source: data.gov.sg",
theme = theme_light())carbon_dioxide_emissions_from_combustion_of_fossil_fuels <- read_csv("data/climate-change-and-energy-carbon-dioxide-emissions-from-combustion-of-fossil-fuels/carbon-dioxide-emissions-from-combustion-of-fossil-fuels.csv")## Rows: 7 Columns: 2
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## dbl (2): year, co2_emissions
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
carbon_dioxide_emissions_from_combustion_of_fossil_fuels %>%
gg_line(x_var = year,
y_var = co2_emissions,
title = "Carbon Dioxide Emissions (From Combustion of Fossil Fuels)",
x_title = "",
y_title = "",
caption = "Graphic: @wyuet. Source: data.gov.sg",
theme = theme_light())waste_disposed_of_and_recycled_annual <- read_csv("data/waste-disposed-of-and-recycled-annual/waste-disposed-of-and-recycled-annual.csv")## Rows: 15 Columns: 3
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## dbl (3): year, waste_disposed_of, waste_recycled
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
#change data to long format
waste_disposed_of_and_recycled_annual_long <- melt(waste_disposed_of_and_recycled_annual, id = "year")waste_disposed_of_and_recycled_annual_long %>%
gg_hbar_col(x_var = value,
y_var = year,
col_var = variable,
y_rev = TRUE,
x_title = "",
y_title = "",
title = "Waste Disposed Of And Recycled (Annual)",
col_title = "",
caption = "Graphic: @wyuet. Source: data.gov.sg",
theme = theme_light())